package com.example.opentransaction.service;

import com.example.opentransaction.dao.UserMapper;
import com.example.opentransaction.domain.User;
import com.example.opentransaction.domain.UserExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class Change2ServiceImpl implements Change2Service{
    @Autowired
    private UserMapper userMapper;

    public User find(Integer userId){
        User u =userMapper.selectByPrimaryKey(userId);

        return u;
    }

    public String selTest(Integer userId){
        User u1 = userMapper.selectByPrimaryKey(userId);
        u1.setMoney(66666L);
        UserExample userExample = new UserExample();
        UserExample.Criteria criteria = userExample.createCriteria();
        criteria.andUserIdEqualTo(userId);
        int n =userMapper.updateByExampleSelective(u1,userExample);
        if (n>0){
            return "修改成功";

        }else {
            return "修改失败";
        }
    }
}
